package com.pshare.session.impl.redis;

import com.pshare.session.SessionFactory;
import com.pshare.session.impl.DefaultSessionImpl;

public class RedisSessionImpl extends DefaultSessionImpl {

	private static final long serialVersionUID = 5819355285270008237L;
	
	public RedisSessionImpl(String id, SessionFactory factory) {
		super(id, factory);
	}

    @Override
    public void setAttribute(String key, Object value) {
        super.setAttribute(key, value);
        this.store();
    }

    @Override
    public void update(long time) {
        super.update(time);
        this.store();
    }

    private void store() {
        getFactory().put(this);
    }

}
